# -*- encoding=utf8 -*-
"""
RedFlag-TC000043   道具名称检查
道具名称检查场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("---------------------------------道具名称检查场景-------------------------------------")
"""
进入相机拍摄
点击道具
等到道具元素展示
滑动道具分类到节日
点击节日分类
获取文本
断言
"""

shooter.enter_photograph()
shooter.click_element(shooting_page_prop)
shooter.wait_for_element_appearance(shooting_page_select_prop,20)
shooter.swipe_until_element_found(shooting_page_item_festival_classification,(0.85, 0.66), (0.2, 0.66), 10)
shooter.click_element(shooting_page_item_festival_classification)
text = shooter.get_element_text(shooting_page_select_prop[4].child()[1])
shooter.assert_texts_equal(text, "初十一子婿日", "断言失败，获取文本与预期文本不一致")

# 关闭应用
stop_app(UGC_package_name)